/**
 * Copyright 2011, Wannabet Developers
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.googlecode.wannabet.oauth.impl {
	
	import com.googlecode.wannabet.oauth.AbstractOAuth;
	import com.googlecode.wannabet.oauth.OAuthConsumer;
	import com.googlecode.wannabet.oauth.sign.IOAuthSigner;
	import com.googlecode.wannabet.oauth.sign.OAuthHMACSHA1Signer;
	import com.googlecode.wannabet.util.KeyValuePair;
	
	import flash.net.URLRequestMethod;

	public class GoogleOAuth extends AbstractOAuth {
		
		public function GoogleOAuth(consumerKey:String, consumerSecret:String) {
			super(new OAuthConsumer(consumerKey, consumerSecret));
		}
		
		override protected function getAdditionRequetParamTokens():Array {
			var array:Array = new Array();
			array.push(new KeyValuePair('scope', "https://www.googleapis.com/auth/userinfo#email"));
			return array;
		}
		
		override protected function getSigner():IOAuthSigner {
			return new OAuthHMACSHA1Signer();
		}

		override protected function getRequestTokenURL():String {
			return "https://www.google.com/accounts/OAuthGetRequestToken";
		}
		
		override protected function getAuthorizeTokenURL():String {
			return "https://www.google.com/accounts/OAuthAuthorizeToken";
		}
		
		override protected function getAccessTokenURL():String {
			return "https://www.google.com/accounts/OAuthGetAccessToken";
		}
		
		override protected function getCallbackURL():String {
			return "http://wannabet.appspot.com/oauth";
		}
		
		override protected function getHttpRequestMethod():String {
			return URLRequestMethod.GET;
		}
	}
}
